#ifndef modedecryptbase_H
#define modedecryptbase_H

#include <QObject>
#include <QMap>

class ModeDecryptBase : public QObject
{
    Q_OBJECT
public:
    enum E_ProgramModeType
    {
        E_ProgramModeType_MAIN, //主模块
        E_ProgramModeType_End
    };
private:
    ModeDecryptBase(){}
public:
    explicit ModeDecryptBase(ModeDecryptBase::E_ProgramModeType emProgramModeType,QObject *parent = NULL);
    /**
     * @brief getNum        解密获取序列号
     * @param s             注册码
     * @return              序列号
     */
    QString getNum(QString s);
    /**
     * @brief getDate       解密获取锁机日期
     * @param s             注册码
     * @return              锁机日期
     */
    QString getDate(QString s);
private:
    char checkNumber(char n);
    char checkCharacterA(char c);
    char checkCharacterH(char c);
    char checkCharacterQ(char c);
    char checkCharacterL(char c);
    char checkCharacterM(char c);


    int setCheckNumber(QMap<char,char>& mapCheckNumber);
    int setCheckRandNumber(QMap<int,char>& mapCheckRandNumber);
    int setCheckCharacterAHQLM(QMap<char,int>& mapCheckCharacterAHQLM);
signals:

public slots:
private:
    E_ProgramModeType emProgramModeType;
    QMap<char,char> mapCheckNumber;
    QMap<char,int> mapCheckRandNumber;
    QMap<char,int> mapCheckCharacterAHQLM;

};

#endif // modedecryptbase_H
